package com.kuang.log;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

/**利用注解自己写的日志类
 * @author FHL
 */
@Aspect
public class AnnotationPointCut {
    @Before("execution(* com.kuang.service.ServiceImpl.*(..))")
    public void before(){
        System.out.println("########方法执行前的日志#########");
    }
    @After("execution(* com.kuang.service.ServiceImpl.*(..))")
    public void after(){
        System.out.println("########方法执行后的日志#########");
    }
    @Around("execution(* com.kuang.service.ServiceImpl.*(..))")
    public void around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("环绕前，，，");
        System.out.println("签名"+pjp.getSignature());
        //执行目标方法proceed
            Object proceed = pjp.proceed();
            System.out.println("环绕后，，，");
            System.out.println(proceed);
    }
}
